package com.example.demo.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("rocket-mq")
public class RocketMQController {

    @Resource
    private RocketMQTemplate rocketMQTemplate;

    @GetMapping("message")
    public ResponseEntity<?> message(){
        List<String> receive = rocketMQTemplate.receive(String.class);
        return ResponseEntity.ok(receive);
    }
}
